<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #parent{
            width: 500px;
            height: 500px;
            background: deeppink;
            display: flex;
            align-items: center; /*垂直方向居中*/
            justify-content: center;  /*水平方向居中*/
        }
        #child{
            width: 200px;
            height: 200px;
            background: skyblue;
        }
    </style>
</head>
<body>
    <div id="parent">
        <span id="child">child</span>
    </div>
</body>
</html>